package com.taotao.controller;

import com.taotao.pojo.EasyUIDataGridResult;
import com.taotao.pojo.TaotaoResult;
import com.taotao.service.ItemParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 规格参数模块
 */

@Controller
@RequestMapping("/item/param")
public class ItemParamController {
    @Autowired
    private ItemParamService itemParamService;

    /**
     * 规格参数列表加载
     * @param page
     * @param rows
     * @return
     */
    @RequestMapping("/list")
    @ResponseBody
    public EasyUIDataGridResult getItemList(Integer page,Integer rows) {
        return  itemParamService.getItemParamList(page,rows);
    }

    /**
     * 规格模板参数删除
     * @param ids
     * @return
     */
    @RequestMapping("/delete")
    @ResponseBody
    public TaotaoResult deleteItemByIds(String ids) {
        return  itemParamService.deleteItemByIds(ids);
    }

    /**
     * 测试是否已添加规格模板是否存在
     * cid
     * @return
     */
    @RequestMapping("/test/{cid}")
    @ResponseBody
    public TaotaoResult getItemCatByCid(@PathVariable Long cid) {
        return  itemParamService.getItemCatByCid(cid);
    }
    @RequestMapping("/save/{cid}")
    @ResponseBody
    public TaotaoResult saveItemCat(@PathVariable Long cid,String paramData) {
        return  itemParamService.saveItemCat(cid,paramData);
    }
}
